package com.zhiyou.service.impl;

import com.zhiyou.dao.ContractMapper;
import com.zhiyou.dao.HouseMapper;
import com.zhiyou.dao.LesseeMapper;
import com.zhiyou.entity.Contract;
import com.zhiyou.entity.House;
import com.zhiyou.entity.Lessee;
import com.zhiyou.service.ContractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@SuppressWarnings("all")
@Service
public class ContractServiceImpl implements ContractService {

    @Autowired
    ContractMapper contractMapper;

    @Autowired
    HouseMapper houseMapper;

    @Autowired
    LesseeMapper lesseeMapper;

    @Override
    public List<Contract> getall() {
        return contractMapper.selctContractall();
    }

    @Override
    public List<Contract> getLikeAll(String cname) {
        return contractMapper.selctlikeall(cname);
    }

    @Override
    public int insetcontract(Contract contract) {
        return contractMapper.insert(contract);
    }

    @Override
    public List<House> selectbyid(Contract contract) {
        return houseMapper.select(contract.getHouse());
    }

    @Override
    public List<Lessee> selectbylessee(Contract contract) {
        return lesseeMapper.select(contract.getLessee());
    }

    @Override
    public int delcontract(int cid) {
        return contractMapper.upcStatus(cid);
    }

    @Override
    public List<Contract> selectbycid(Contract contract) {
        return contractMapper.select(contract);
    }

    @Override
    public int updatacontract(Contract contract) {
        return contractMapper.updatacontract(contract);
    }

    @Override
    public List<Contract> getstatus() {
        return contractMapper.getstatus();
    }
}
